﻿using BasicInformation.ApiRead.Application.Command.Category;
using BasicInformation.Dtos;
using BasicInformation.ErrorCode;
using MediatR;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace BasicInformation.ApiRead.Controllers
{
    /// <summary>
    /// 产品类别——读
    /// </summary>
    [Route("api/[controller]/[action]")]
    [ApiController]
  //  [Authorize]
    public class CategoryController : ControllerBase
    {
        private readonly IMediator mediator;

        public CategoryController(IMediator mediator)
        {
            this.mediator = mediator;
        }
        /// <summary>
        /// 产品类别查询显示分页接口
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<ApiPaging<CategoryDTO>> GetCategory([FromQuery]GetCategoryCommand request)
        {
            return await mediator.Send(request);
        }
    }
}
